/**
 * Created by thomas on 2018/2/7.
 */
export default {
  get_default_card:function(_this,cb){
    console.log(_this)
    _this.$http.post(_this.base_url+'/yizhiweimen/api/user/personalHomepage/todayToadd',
      _this.$t_qs.stringify(
        {
          'uid':_this.user_id ,
        })
    )
      .catch((thrown) => {
        console.log(thrown);
      })
      .then((e) => {
        console.log(e);
        if( _this.default_card_list.length === 0 ){
          _this.default_card_list = false
        }else{
          _this.default_card_list = e;
        }
        cb();
      })
  },
  get_card_mess:function (_this) {
    _this.$http.post(_this.base_url+'/yizhiweimen/api/user/personalHomepage/getPageHomeByUser',
      _this.$t_qs.stringify(
        {
          'Uid':_this.user_id ,
          "openUid":_this.user_id
        })
    )
      .catch((thrown) => {
        console.log(thrown)
      }).then((e) => {
      _this.$t_Indicator.close();
      if (!e.data) return;
      //this.card_list = e.data
      let e_data_len = e.data.length;
      for (let x = 0; x < e_data_len; x++) {
        for (let y = 0; y < e.data[x].adventurecards.length; y++){
          if (y == 1) {
            e.data[x].adventurecards[y].act = true
          } else if (e.data[x].adventurecards.length == 1) {
            e.data[x].adventurecards[0].act = true
          } else {
            e.data[x].adventurecards[y].act = false
          }
        }
      }
      _this.card_list = e.data;
      _this.user_index_show_data = true;
      _this.loading_mask_flag = false;
    })
  }

}
